import request from "@/utils/request";


export interface  AttrValueData {
    id?: number;
    valueName: string;
    attrId?: number;
  }

export type AttrValueListData = AttrValueData[]


export type AttrPageData = {
  id?:  number;
  attrName: string;
  categoryId: number;
  categoryLevel: number;
  attrValueList:AttrValueListData
}

export type AttrPageListData = AttrPageData[]



export default {
  //GET /admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id}
  // 获取属性列表数据  
  attrInfoList(category1Id: number, category2Id: number, category3Id: number) {
    return request.get<any,AttrPageListData>(`/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`);
  },

  // DELETE /admin/product/deleteAttr/{attrId}
 // 删除属性数据
  deleteAttr(attrId:number){
    return request.delete<any,null>(`/admin/product/deleteAttr/${attrId}`)
  },

  // POST /admin/product/saveAttrInfo
  // 添加或者修改属性  
  saveOrUpdateAttrInfo(attrInfo:AttrPageData){
    return  request.post<any,null>('/admin/product/saveAttrInfo',attrInfo)
  }
};
